package com.xhwl.logistics.controller;

import com.xhwl.common.pojo.ResultJson;
import com.xhwl.logistics.service.impl.VehicleCardServiceImpl;
import com.xhwl.logistics.vo.VehicleCardTypeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

//@RestController
public class VehicleCardTypeController {

    @Autowired
    private VehicleCardServiceImpl vehicleCardService;

    /**
     * 根据项目id获取该项目中存在的卡类型，避免一个项目中出现多个卡类型
     * @return
     */
    @GetMapping("/card-type/list")
    public ResultJson<List<VehicleCardTypeVO>> cardType(@RequestParam Integer projectId) {
//        List<VehicleCardTypeVO> vehicleCardTypeVOList = Stream.of(VehicleCardTypeEnum.validVehicleCardTypeEnum())
//                .map(vehicleCardTypeEnum -> new VehicleCardTypeVO(vehicleCardTypeEnum.getDescription()))
//                .collect(Collectors.toList());
//        return ResultJson.successWithResult(vehicleCardTypeVOList);
        return ResultJson.successWithResult(vehicleCardService.listCardTypeByProjectId(projectId));
    }

}
